package com.allwees.bs.c.module.user.repository;

import com.allwees.bs.c.module.base.repository.BaseRepository;
import com.allwees.bs.c.module.user.entity.UserPromoLogEntity;
import com.allwees.bs.core.model.coupon.constant.EPromoUseType;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface UserPromoLogRepository extends BaseRepository<UserPromoLogEntity, Long> {

    @Query("SELECT s FROM UserPromoLogEntity s WHERE s.userUuid = :userUuid AND useType = :useType AND s.isDeleted = 0")
    List<UserPromoLogEntity> findByUserUuidAndUseType(String userUuid, EPromoUseType useType);

    UserPromoLogEntity findByUuid(String uuid);

    List<UserPromoLogEntity> findAllByUserUuid(String userUuid);
}
